<template>
    <div id="pdf"></div>
</template>

<script>
import jsPreviewPdf from "@js-preview/pdf";
export default {
    name: "JsPreviewPdfDemo",
    data() {
        return {
            myPdfPreviewer: null
        }
    },
    mounted() {
        this.myPdfPreviewer = jsPreviewPdf.init(document.getElementById('pdf'), {
            onError: (e) => {
                console.log('发生错误', e)
            },
            onRendered: () => {
                console.log('渲染完成')
            }
        });
        this.myPdfPreviewer.preview('/api/api/v1/download-shared-object/aHR0cDovLzEyNy4wLjAuMTo5MDAwL3Nlbmlvci12YWx2ZS1odWIvdHV0b3JpYWxzLyVFNyU5NCVCNSVFNSVBRCU5MCVFNSU4RiU5MSVFNyVBNSVBOC1GSCVFNSVCMCU4RiVFNyVBOCU4QiVFNSVCQSU4Ri5wZGY_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD00RzJLREJLVElKSlJWMU5UVTJMRyUyRjIwMjUwNTIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDUyM1QxMDM2NTZaJlgtQW16LUV4cGlyZXM9NDMxOTkmWC1BbXotU2VjdXJpdHktVG9rZW49ZXlKaGJHY2lPaUpJVXpVeE1pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmhZMk5sYzNOTFpYa2lPaUkwUnpKTFJFSkxWRWxLU2xKV01VNVVWVEpNUnlJc0ltVjRjQ0k2TVRjME9EQXpOakF5TVN3aWNHRnlaVzUwSWpvaWJXbHVhVzloWkcxcGJpSjkuM2xHbnVNU0tPTGQ0X1N2TXRpUHFIOG0zeldMN1MzeWpLakVMcjBQcldQei1KX2dNVFBNV2p2SnlZRGx3eDktaTFRZ2V6VXpLX1QteExGcjMxZkpJS0EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnZlcnNpb25JZD1udWxsJlgtQW16LVNpZ25hdHVyZT00ZmRkYjYwZjU3NmI2YjQwODgyMjc2MjRjNTMzOWYzYjQ5ZjZiNmM4ODAwMWNlMGYzYmQwNWNmNzU1MDc3ZWVi');
    },
    beforeDestroy() {
        this.myPdfPreviewer.destroy();
    }
};
</script>

<style scoped></style>